using UnityEngine;

public class GGFacebook : MonoBehaviour
{
	public struct FriendRequestData
	{
		public string message;

		public string userIds;

		public string actionType;

		public string objectId;
	}

	public delegate void OnConnectStatusChanged(bool connected);

	public static GGFacebook instance_;

	private static GameObject instanceGameObject_;

	public static GGFacebook instance
	{
		get
		{
			if (instance_ == null)
			{
				instanceGameObject_ = GameObject.Find("GGFacebook");
				if (instanceGameObject_ == null)
				{
					instanceGameObject_ = new GameObject("GGFacebook");
				}
				instance_ = instanceGameObject_.GetComponent<GGFacebook>();
				if (instance_ == null)
				{
					instance_ = instanceGameObject_.AddComponent<GGFacebookAndroid>();
					instance_.Init();
				}
				Object.DontDestroyOnLoad(instanceGameObject_);
			}
			return instance_;
		}
	}

	public event OnConnectStatusChanged onStatusChanged;

	protected virtual void Init()
	{
	}

	public virtual void showShareDialog(string applicationName, string title, string subtitle, string description, string link)
	{
	}

	public virtual bool IsAvailable()
	{
		return false;
	}

	public virtual bool IsConnected()
	{
		return false;
	}

	public void OnPlayerConnectSuccess(string status)
	{
		GGDebug.DebugLog("Player connected to FB");
		if (this.onStatusChanged != null)
		{
			this.onStatusChanged(true);
		}
	}

	public void OnPlayerDisconnectSuccess(string status)
	{
		GGDebug.DebugLog("Player disconnected from FB");
		if (this.onStatusChanged != null)
		{
			this.onStatusChanged(false);
		}
	}

	public virtual string GetAccessToken()
	{
		return ConfigBase.instance.facebookTestAccessToken;
	}

	public virtual void OnTryConnect()
	{
	}

	public virtual void OnTryDisconnect()
	{
	}

	public virtual void OnClickRequestButton(FriendRequestData requestData)
	{
		GGDebug.DebugLog("Send requests to facebook!");
	}
}
